FROM docker.1ms.run/library/centos:centos7.9.2009
# docker build -f <Dockerfile路径> -t <镜像名称:标签> <上下文路径>
# docker build -f sshdCentos -t
RUN curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo \
    && yum clean all \
    && yum makecache \
    && yum install -y openssh-server \
    && ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N "" \
    && ssh-keygen -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key -N "" \
    && ssh-keygen -t ed25519 -f /etc/ssh/ssh_host_ed25519_key -N "" \
    && echo "root:abc...123"|chpasswd \
    && nohup /usr/sbin/sshd -D >/dev/null 2>&1 &
EXPOSE 22
CMD [ "/bin/bash" ]